﻿Imports lbGlobalcom
Public Class fMediosPago
    Dim daMP As dsBancosTableAdapters.GLO_MEDIOSPAGOTableAdapter

    Private Sub fMediosPago_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try
            daMP = New dsBancosTableAdapters.GLO_MEDIOSPAGOTableAdapter
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub btnCargaMedios_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCargaMedios.Click
        daMP.Fill(DsBancos.GLO_MEDIOSPAGO)
    End Sub
    Private Sub Salvar(ByVal msj As Boolean)
        Try
            Validate()
            GLO_MEDIOSPAGOBindingSource.EndEdit()
            daMP.Update(DsBancos.GLO_MEDIOSPAGO)
            If msj Then _
                MessageBox.Show("Se salvarón registros con exito", "Salvar Registros", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
    Private Sub GLO_MEDIOSPAGOBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GLO_MEDIOSPAGOBindingNavigatorSaveItem.Click
        Salvar(True)
    End Sub

    Private Sub BindingNavigatorDeleteItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorDeleteItem.Click
        Try
            If MessageBox.Show("Esta seguro que desea eliminar registro", "Elimina Registro", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then
                GLO_MEDIOSPAGOBindingSource.RemoveCurrent()
                Salvar(False)
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub
End Class